package exam.meituan.T3;


import java.util.Scanner;

public class Main {

    public static int n = 0;
    public static int m1 = 0;
    public static int m2 = 0;
    public static int num = 0;
    public static int[] left1;
    public static int[] left2;
    public static int[] right1;
    public static int[] right2;
    public static boolean[] file;

    public static void main(String[] args) {
        inputParams();
        file = new boolean[30001];
        for (int i=0; i<m1; ++i) {
            for (int j=left1[i]; j<=right1[i]; ++j) {
                file[j] = true;
            }
        }

        for (int i=0; i<m2; ++i) {
            for (int j=left2[i]; j<=right2[i]; ++j) {
                if (file[j])
                    num++;
            }
        }
        System.out.println(num);
    }

    public static void inputParams() {
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        m1 = sc.nextInt();
        m2 = sc.nextInt();
        left1 = new int[m1];
        right1 = new int[m1];
        for (int i=0; i<m1; ++i) {
            left1[i] = sc.nextInt();
        }
        for (int i=0; i<m1; ++i) {
            right1[i] = sc.nextInt();
        }
        left2 = new int[m2];
        right2 = new int[m2];
        for (int i=0; i<m2; ++i) {
            left2[i] = sc.nextInt();
        }
        for (int i=0; i<m2; ++i) {
            right2[i] = sc.nextInt();
        }
    }
}
